home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / grafik / converter / mpimage42 / include / inline / mpimage.h < prev   
Encoding:
C/C++ Source or Header  |  1996-07-16  |  3.4 KB  |  150 lines

  1. #ifndef _INLINE_MPIMAGE_H
  2. #define _INLINE_MPIMAGE_H
  3.  
  4. #include <sys/cdefs.h>
  5. #include <inline/stubs.h>
  6.  
  7. __BEGIN_DECLS
  8.  
  9. #ifndef BASE_EXT_DECL
  10. #define BASE_EXT_DECL
  11. #define BASE_EXT_DECL0 extern struct Library * MPImageBase;
  12. #endif
  13. #ifndef BASE_PAR_DECL
  14. #define BASE_PAR_DECL
  15. #define BASE_PAR_DECL0 void
  16. #endif
  17. #ifndef BASE_NAME
  18. #define BASE_NAME MPImageBase
  19. #endif
  20.  
  21. BASE_EXT_DECL0
  22.  
  23. __inline extern void FreeMPImage( BASE_PAR_DECL struct MPImage *MPi)
  24. {
  25.     BASE_EXT_DECL
  26.     register void *a6 __asm("a6");
  27.     register struct MPImage *a0 __asm("a0");
  28.  
  29.     a6 = BASE_NAME;
  30.     a0 = MPi;
  31.     __asm volatile ("
  32.     jsr a6@(-0x24)"
  33.     : /* no output */
  34.     : "r" (a6), "r" (a0)
  35.     : "d0", "d1", "a0", "a1" );
  36. }
  37. __inline extern struct MPImage* LoadMPImage( BASE_PAR_DECL const char *filename, struct Screen *screen, ULONG Flags)
  38. {
  39.     BASE_EXT_DECL
  40.     register struct MPImage * res __asm("d0");
  41.     register void *a6 __asm("a6");
  42.     register const char *a0 __asm("a0");
  43.     register struct Screen *a1 __asm("a1");
  44.     register ULONG d0 __asm("d0");
  45.  
  46.     a6 = BASE_NAME;
  47.     a0 = filename;
  48.     a1 = screen;
  49.     d0 = Flags;
  50.     __asm volatile ("
  51.     jsr a6@(-0x1e)"
  52.     : "=r" (res)
  53.     : "r" (a6), "r" (a0), "r" (a1), "r" (d0)
  54.     : "d0", "d1", "a0", "a1" );
  55.     return res;
  56. }
  57. __inline extern char * MPImageErrorMessage( BASE_PAR_DECL0 )
  58. {
  59.     BASE_EXT_DECL
  60.     register char * res __asm("d0");
  61.     register void *a6 __asm("a6");
  62.  
  63.     a6 = BASE_NAME;
  64.     __asm volatile ("
  65.     jsr a6@(-0x2a)"
  66.     : "=r" (res)
  67.     : "r" (a6)
  68.     : "d0", "d1", "a0", "a1" );
  69.     return res;
  70. }
  71. __inline extern BOOL RescaleMPImage( BASE_PAR_DECL struct MPImage *MPi, UWORD x, UWORD y )
  72. {
  73.     BASE_EXT_DECL
  74.     register BOOL res __asm("d0");
  75.     register void *a6 __asm("a6");
  76.     register struct MPImage *a0 __asm("a0");
  77.     register UWORD d0 __asm("d0");
  78.     register UWORD d1 __asm("d1");
  79.  
  80.     a6 = BASE_NAME;
  81.     a0 = MPi;
  82.     d0 = x;
  83.     d1 = y;
  84.     __asm volatile ("
  85.     jsr a6@(-0x36)"
  86.     : "=r" (res)
  87.     : "r" (a6), "r" (a0), "r" (d0), "r" (d1)
  88.     : "d0", "d1", "a0", "a1" );
  89.     return res;
  90. }
  91. __inline extern BOOL SaveMPImageA( BASE_PAR_DECL const UBYTE *file, UBYTE *red, UBYTE *green, UBYTE *blue, UWORD width, UWORD height, struct TagItem *TagList )
  92. {
  93.     BASE_EXT_DECL
  94.     register BOOL res __asm("d0");
  95.     register void *a6 __asm("a6");
  96.     register const UBYTE *a0 __asm("a0");
  97.     register UBYTE *a1 __asm("a1");
  98.     register UBYTE *a2 __asm("a2");
  99.     register UBYTE *a3 __asm("a3");
  100.     register UWORD d0 __asm("d0");
  101.     register UWORD d1 __asm("d1");
  102.     register struct TagItem *a5 __asm("a5");
  103.  
  104.     a6 = BASE_NAME;
  105.     a0 = file;
  106.     a1 = red;
  107.     a2 = green;
  108.     a3 = blue;
  109.     d0 = width;
  110.     d1 = height;
  111.     a5 = TagList;
  112.     __asm volatile ("
  113.     jsr a6@(-0x30)"
  114.     : "=r" (res)
  115.     : "r" (a6), "r" (a0), "r" (a1), "r" (a2), "r" (a3), "r" (d0), "r" (d1), "r" (a5)
  116.     : "d0", "d1", "a0", "a1", "a2", "a3", "a5" );
  117.     return res;
  118. }
  119. #ifndef NO_INLINE_STDARG
  120. #define SaveMPImage(a0, a1, a2, a3, d0, d1, tags...) \
  121.   ({ struct TagItem _tags[] = { tags }; SaveMPImageA ((a0), (a1), (a2), (a3), (d0), (d1), _tags); })
  122. #endif /* not NO_INLINE_STDARG */
  123.  
  124. __inline extern void SetMPImageScreen( BASE_PAR_DECL char *ScreenName , ULONG Flags )
  125. {
  126.     BASE_EXT_DECL
  127.     register void *a6 __asm("a6");
  128.     register char *a0 __asm("a0");
  129.     register ULONG d0 __asm("d0");
  130.  
  131.     a6 = BASE_NAME;
  132.     a0 = ScreenName;
  133.     d0 = Flags;
  134.     __asm volatile ("
  135.     jsr a6@(-0x3c)"
  136.     : /* no output */
  137.     : "r" (a6), "r" (a0), "r" (d0)
  138.     : "d0", "d1", "a0", "a1" );
  139. }
  140.  
  141. #undef BASE_EXT_DECL
  142. #undef BASE_EXT_DECL0
  143. #undef BASE_PAR_DECL
  144. #undef BASE_PAR_DECL0
  145. #undef BASE_NAME
  146.  
  147. __END_DECLS
  148.  
  149. #endif /* _INLINE_MPIMAGE_H */
  150.